package com.aipp.mall.h5.controller;

import com.aipp.mall.h5.domain.query.ProductQuery;
import com.aipp.mall.h5.domain.vo.H5ProductVO;
import com.aipp.mall.h5.domain.vo.ProductDetailVO;
import com.aipp.mall.h5.service.ProductService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 商品信息接口
 *
 * @author Administrator
 */
@RestController
@RequestMapping("/no-auth/product")
public class H5ProductController {

    @Resource
    private ProductService productService;

    @PostMapping("/list")
    public ResponseEntity<IPage<H5ProductVO>> queryGoodByPage(@RequestBody ProductQuery query) {
        return ResponseEntity.ok(productService.selectList(query));
    }

    @GetMapping("/detail/{id}")
    public ResponseEntity<ProductDetailVO> queryDetail(@PathVariable Long id) {
        ProductDetailVO detail = productService.queryDetail(id);
        return ResponseEntity.ok(detail);
    }
}
